#include "CpLog.h"
#include "CpTrack.h"
#include "CpPoint.h"

ClassImp(CpTrack);

//________________________________________________________________________________________________________________
CpTrack::CpTrack(const Int_t& index): TObject(),
   fIndex(index),
   fNumberOfPoints(0),
   fPoints("CpPoint", fNumberOfPoints + 1)
{
//
// Constructor
//
}

//________________________________________________________________________________________________________________
CpTrack::~CpTrack()
{
//
// Destructor.
//
  fPoints.Delete();
}


void CpTrack::Print(Option_t* /*option*/) const
{
   CpInfo(Form("Track %d" , fIndex));

   CpPoint *point;
   for (Long64_t iPoint = 0; iPoint < fNumberOfPoints; iPoint++) {
      point = (CpPoint*) fPoints.At(iPoint);
      point->Print();
   }
}


CpPoint* CpTrack::AddPoint(const Double_t& x, const Double_t& y, const Double_t& z,const Double_t& vx, const Double_t& vy, const Double_t& vz, const Double_t& time)
{
   return new(fPoints[fNumberOfPoints++]) CpPoint(x, y, z, vx,vy,vz,time);
}
